home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Orlando_1993 / Devcon93.4 / Networking2 / AS225 / include / protocols / routed.h next >
Encoding:
C/C++ Source or Header  |  1993-01-11  |  2.8 KB  |  84 lines

  1. /*
  2.  * Copyright (c) 1983 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  *    %W% (Berkeley) %G%
  18.  */
  19.  
  20. /*
  21.  * Routing Information Protocol
  22.  *
  23.  * Derived from Xerox NS Routing Information Protocol
  24.  * by changing 32-bit net numbers to sockaddr's and
  25.  * padding stuff to 32-bit boundaries.
  26.  */
  27. #define    RIPVERSION    1
  28.  
  29. struct netinfo {
  30.     struct    sockaddr rip_dst;    /* destination net/host */
  31.     int    rip_metric;        /* cost of route */
  32. };
  33.  
  34. struct rip {
  35.     u_char    rip_cmd;        /* request/response */
  36.     u_char    rip_vers;        /* protocol version # */
  37.     u_char    rip_res1[2];        /* pad to 32-bit boundary */
  38.     union {
  39.         struct    netinfo ru_nets[1];    /* variable length... */
  40.         char    ru_tracefile[1];    /* ditto ... */
  41.     } ripun;
  42. #define    rip_nets    ripun.ru_nets
  43. #define    rip_tracefile    ripun.ru_tracefile
  44. };
  45.  
  46. /*
  47.  * Packet types.
  48.  */
  49. #define    RIPCMD_REQUEST        1    /* want info */
  50. #define    RIPCMD_RESPONSE        2    /* responding to request */
  51. #define    RIPCMD_TRACEON        3    /* turn tracing on */
  52. #define    RIPCMD_TRACEOFF        4    /* turn it off */
  53.  
  54. #define    RIPCMD_MAX        5
  55. #ifdef RIPCMDS
  56. char *ripcmds[RIPCMD_MAX] =
  57.   { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" };
  58. #endif
  59.  
  60. #define    HOPCNT_INFINITY        16    /* per Xerox NS */
  61. #define    MAXPACKETSIZE        512    /* max broadcast size */
  62.  
  63. /*
  64.  * Timer values used in managing the routing table.
  65.  * Complete tables are broadcast every SUPPLY_INTERVAL seconds.
  66.  * If changes occur between updates, dynamic updates containing only changes
  67.  * may be sent.  When these are sent, a timer is set for a random value
  68.  * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates
  69.  * are sent until the timer expires.
  70.  *
  71.  * Every update of a routing entry forces an entry's timer to be reset.
  72.  * After EXPIRE_TIME without updates, the entry is marked invalid,
  73.  * but held onto until GARBAGE_TIME so that others may
  74.  * see it "be deleted".
  75.  */
  76. #define    TIMER_RATE        30    /* alarm clocks every 30 seconds */
  77.  
  78. #define    SUPPLY_INTERVAL        30    /* time to supply tables */
  79. #define    MIN_WAITTIME        2    /* min. interval to broadcast changes */
  80. #define    MAX_WAITTIME        5    /* max. time to delay changes */
  81.  
  82. #define    EXPIRE_TIME        180    /* time to mark entry invalid */
  83. #define    GARBAGE_TIME        240    /* time to garbage collect */
  84.